<!DOCTYPE HTML PUBLIC "-//ORA//DTD CD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>[Chapter 17] Date</TITLE>
<META NAME="author" CONTENT="Mark Grand and Jonathan Knudsen">
<META NAME="date" CONTENT="Fri Aug  8 17:41:49 1997">
<META NAME="form" CONTENT="html">
<META NAME="metadata" CONTENT="dublincore.0.1">
<META NAME="objecttype" CONTENT="book part">
<META NAME="otheragent" CONTENT="gmat dbtohtml">
<META NAME="publisher" CONTENT="O'Reilly &amp; Associates, Inc.">
<META NAME="source" CONTENT="SGML">
<META NAME="subject" CONTENT="Java">
<META NAME="title" CONTENT="Java Fundamental Classes Reference">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
</HEAD>
<body vlink="#551a8b" alink="#ff0000" text="#000000" bgcolor="#FFFFFF" link="#0000ee">

<DIV CLASS=htmlnav>
<H1><a href='index.htm'><IMG SRC="gifs/smbanner.gif"
     ALT="Java Fundamental Classes Reference" border=0></a></H1>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch17_02.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><B><FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1">Chapter 17<br>The java.util Package</FONT></B></TD>
<td width=172 align=right valign=top><A HREF="ch17_04.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
</table>

&nbsp;
<hr align=left width=515>
</DIV>
<DIV CLASS=refnamediv>
<H1>Date</H1>

<H2>Name</H2>

Date

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch17-REFSECT1-AUTOID.19">Synopsis</A></h2>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Class Name:<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>java.util.Date</tt>

<p>
<DT CLASS=varlistentry>Superclass:<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>java.lang.Object</tt>

<p>
<DT CLASS=varlistentry>Immediate Subclasses:<br>
<DD>

<P CLASS=para>
None

<p>
<DT CLASS=varlistentry>Interfaces Implemented:<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>java.lang.Cloneable</tt>, 
<tt CLASS=literal>java.io.Serializable</tt>

<p>
<DT CLASS=varlistentry>Availability:<br>
<DD>

<P CLASS=para>
JDK 1.0 or later </DL>
</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch17-REFSECT1-AUTOID.20">Description</A></h2>

<P CLASS=para>
The <tt CLASS=literal>Date</tt> class encapsulates a point in time with
millisecond precision. The value of a <tt CLASS=literal>Date</tt> is
represented internally by a <tt CLASS=literal>long</tt> value that
contains the number of milliseconds since midnight, January 1, 1970
GMT.

<P CLASS=para>
Prior to JDK 1.1, the <tt CLASS=literal>Date</tt> class was used for two
purposes that are now encapsulated by other classes.  First, the
<tt CLASS=literal>Date</tt> class included methods for calculating
calendar values, like months and days of the week.  This functionality
is now embedded in the <tt CLASS=literal>Calendar</tt> class. Second, the
<tt CLASS=literal>Date</tt> class included methods for generating and
parsing a string representation of a date. This functionality is now
provided by <tt CLASS=literal>java.text.DateFormat</tt>.  Thus, as of JDK
1.1, most of the methods of <tt CLASS=literal>Date</tt> are deprecated;
the class is used only to represent a point in time.

<P CLASS=para>
The accurate measurement of time is a subject of considerable
complexity and multifarious acronyms. There are two main methods of
measuring time, atomic and astronomical. The U.S. Naval
Observatory (<I CLASS=emphasis>http://tycho.usno.navy.mil</I>) maintains
a set of atomic clocks that provide the basis for Coordinated
Universal Time (UTC). These clocks adhere to precise definitions of
the second based on atomic decay.

<P CLASS=para>
Outside of the U.S. Navy, people tend to measure time in terms of Greenwich 
Mean Time (GMT). In the scientific community, GMT is called UT, which is 
a system of time predicated on the assumption that each rotation of the 
earth is exactly 24 * 60 * 60 seconds long. Because the earth's rotation 
is gradually slowing down, the seconds in UT are a little bit longer than 
the seconds in UTC. Now and then a "leap second" is added in 
UTC to keep it close to UT. Because the <tt CLASS=literal>Date</tt> 
class simply measures milliseconds since a point in time, without regard 
for leap seconds, it is a good representation of UT or GMT. 

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch17-REFSECT1-AUTOID.21">Class Summary</A></h2>

<DIV CLASS=screen>
<P>
<PRE>
public class java.util.Date extends java.lang.Object
             implements java.lang.Cloneable, java.io.Serializable {
  // Constructors
  public Date();
  public Date(long date);
  public Date(int year, int month, int date);       // Deprecated in 1.1
  public Date(int year, int month, int date, 
              int hrs, int min);                    // Deprecated in 1.1
  public Date(int year, int month, int date, 
              int hrs, int min, int sec);           // Deprecated in 1.1
  public Date(String s);                            // Deprecated in 1.1
  // Class Methods
  public static long parse(String s);               // Deprecated in 1.1
  public static long UTC(int year, int month, 
                         int date, int hrs, 
                         int min, int sec);         // Deprecated in 1.1
  // Instance Methods
  public boolean after(Date when);
  public boolean before(Date when);
  public boolean equals(Object obj); 
  public int getDate();                             // Deprecated in 1.1
  public int getDay();                              // Deprecated in 1.1
  public int getHours();                            // Deprecated in 1.1
  public int getMinutes();                          // Deprecated in 1.1
  public int getMonth();                            // Deprecated in 1.1
  public int getSeconds();                          // Deprecated in 1.1
  public long getTime();
  public int getTimezoneOffset();                   // Deprecated in 1.1
  public int getYear();                             // Deprecated in 1.1
  public int hashCode();
  public void setDate(int date);                    // Deprecated in 1.1
  public void setHours(int hours);                  // Deprecated in 1.1
  public void setMinutes(int minutes);              // Deprecated in 1.1
  public void setMonth(int month);                  // Deprecated in 1.1
  public void setSeconds(int seconds);              // Deprecated in 1.1
  public void setTime(long time);
  public void setYear(int year);                    // Deprecated in 1.1
  public String toGMTString();                      // Deprecated in 1.1
  public String toLocaleString();                   // Deprecated in 1.1
  public String toString();
}
</PRE>
</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch17-REFSECT1-AUTOID.22">Constructors</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.92">Date</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.101">public Date()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This constructor creates a <tt CLASS=literal>Date</tt> 
object that is initialized to the current time. </DL>
</DIV>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.102">public Date(long date)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>date</tt><br>
<DD>

<P CLASS=para>
A time value, measured 
as the number of milliseconds since midnight, January 1, 1970 GMT. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This constructor creates a <tt CLASS=literal>Date</tt> 
object that represents the given time. </DL>
</DIV>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.103">public Date(int year, int month, int day)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1 

<p>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>year</tt><br>
<DD>

<P CLASS=para>
The year specified 
as a value that is added to 1900 to get the actual year.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>month</tt><br>
<DD>

<P CLASS=para>
The month specified 
in the range 0 to 11.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>day</tt><br>
<DD>

<P CLASS=para>
The day of the month 
specified in the range 1 to 31. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This constructor creates a <tt CLASS=literal>Date</tt> 
that represents midnight local time on the specified date. </DL>
</DIV>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.104">public Date(int year, int month, int day, int hrs, int min)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1 

<p>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>year</tt><br>
<DD>

<P CLASS=para>
The year specified 
as a value that is added to 1900 to get the actual year.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>month</tt><br>
<DD>

<P CLASS=para>
The month specified 
in the range 0 to 11.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>day</tt><br>
<DD>

<P CLASS=para>
The day of the month 
specified in the range 1 to 31.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>hrs</tt><br>
<DD>

<P CLASS=para>
The hours specified 
in the range 0 to 23.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>min</tt><br>
<DD>

<P CLASS=para>
The minutes specified 
in the range 0 to 59. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This constructor creates a <tt CLASS=literal>Date</tt> 
that represents the given date and time. </DL>
</DIV>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.105"><DIV CLASS=screen> <P> <PRE> public Date(int year, int month, int day, int hrs, int min, int sec) </PRE> </DIV></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1 

<p>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>year</tt><br>
<DD>

<P CLASS=para>
The year specified 
as a value that is added to 1900 to get the actual year.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>month</tt><br>
<DD>

<P CLASS=para>
The month specified 
in the range 0 to 11.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>day</tt><br>
<DD>

<P CLASS=para>
The day of the month 
specified in the range 1 to 31.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>hrs</tt><br>
<DD>

<P CLASS=para>
The hours specified 
in the range 0 to 23.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>min</tt><br>
<DD>

<P CLASS=para>
The minutes specified 
in the range 0 to 59.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>sec</tt><br>
<DD>

<P CLASS=para>
The seconds specified 
in the range 0 to 59. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This constructor creates a <tt CLASS=literal>Date</tt> 
that represents the given date and time. </DL>
</DIV>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.106">public Date(String s)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1 

<p>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>s</tt><br>
<DD>

<P CLASS=para>
The string to parse. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This constructor creates a <tt CLASS=literal>Date</tt> 
that represents the date and time specified by the given string. The syntax 
of the date in the string must satisfy the requirements of the <tt CLASS=literal>parse()</tt> 
method. The following is an example of a string that this constructor can 
understand: 
<DIV CLASS=screen>
<P>
<PRE>
Sat, 8 Feb 1997 13:30:00 GMT
</PRE>
</DIV>


</DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch17-REFSECT1-AUTOID.23">Class Methods</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.93">parse</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.107">public static long parse(String s)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1 

<p>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>s</tt><br>
<DD>

<P CLASS=para>
The string to parse. </DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
A time value represented as the number of milliseconds since midnight, 
January 1, 1970 GMT. 

<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>IllegalArgumentException</tt><br>
<DD>

<P CLASS=para>
If the string cannot be parsed. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns the raw time value specified by the given string. This 
method understands a number of different formats. The following are examples 
of strings that this method can understand: 

<DIV CLASS=screen>
<P>
<PRE>
Sat, 8 Feb 1997 13:30:00 GMT
4/6/97
4/6/1997
January 5, 1997
2/4/97 11:03 AM
2/4/97 10:25 PM
2/4/97 17:03 GMT-6
2/4/97 17:03:24
March 16, 97 17:03 EST
March (comment)16, 97 (comment) 17:03 EST
16 march 1996 17:03 pdt
Sat 16 march 97 17:03 cst
</PRE>
</DIV>

<P CLASS=para>
The JDK 1.0.2 implementation of <tt CLASS=literal>parse()</tt> has a
serious bug. It incorrectly interprets date formats that specify the
month as a number by making the month one greater than it should be.
So <tt CLASS=literal>2/4/97</tt> is incorrectly interpreted as March 4,
1997.  

<P CLASS=para>
 For the purposes of this method, UTC and GMT are
considered equivalent.</DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.94">UTC</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.108"><DIV CLASS=screen> <P> <PRE> public static long UTC(int year, int month, int date, int hrs, int min, int sec) </PRE> </DIV></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1 

<p>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>year</tt><br>
<DD>

<P CLASS=para>
The year specified 
as a value that is added to 1900 to get the actual year.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>month</tt><br>
<DD>

<P CLASS=para>
The month specified 
in the range 0 to 11.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>day</tt><br>
<DD>

<P CLASS=para>
The day of the month 
specified in the range 1 to 31.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>hrs</tt><br>
<DD>

<P CLASS=para>
The hours specified 
in the range 0 to 23.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>min</tt><br>
<DD>

<P CLASS=para>
The minutes specified 
in the range 0 to 59.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>sec</tt><br>
<DD>

<P CLASS=para>
The seconds specified 
in the range 0 to 59. </DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
A time value represented as the number of milliseconds since midnight, 
January 1, 1970 GMT. 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns a raw time value that corresponds to the given parameters. 
Computations are based on GMT, not the local time zone. </DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch17-REFSECT1-AUTOID.24">Instance Methods</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.95">after</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.109">public boolean after(Date when)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>when</tt><br>
<DD>

<P CLASS=para>
The object to compare 
to this <tt CLASS=literal>Date</tt>. </DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>true</tt> if this object is after 
<tt CLASS=literal>when</tt>; <tt CLASS=literal>false</tt> 
otherwise. 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns <tt CLASS=literal>true</tt> if 
the value of <tt CLASS=literal>when</tt> falls before 
the value of this <tt CLASS=literal>Date</tt>. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.96">before</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.110">public boolean before(Date when)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>when</tt><br>
<DD>

<P CLASS=para>
The object to compare 
to this <tt CLASS=literal>Date</tt>. </DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>true</tt> if this object is before 
<tt CLASS=literal>when</tt>; <tt CLASS=literal>false</tt> 
otherwise. 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns <tt CLASS=literal>true</tt> if 
the value of <tt CLASS=literal>when</tt> falls after 
the value of this <tt CLASS=literal>Date</tt>. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.97">equals</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.111">public boolean equals(Object obj)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>obj</tt><br>
<DD>

<P CLASS=para>
The object to be compared with this object. </DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>true</tt> if the objects are equal; 
<tt CLASS=literal>false</tt> if they are not. 

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Object.equals()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns <tt CLASS=literal>true</tt> if 
<tt CLASS=literal>when</tt> is an instance of <tt CLASS=literal>Date</tt> 
and it contains the same value as the object this method is associated 
with. In other words, the two <tt CLASS=literal>Date</tt> 
objects are equal only if they both represent the same point in time, to 
the millisecond. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.98">getDate</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.112">public int getDate()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1 

<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The day of the month of this <tt CLASS=literal>Date</tt>. 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns the day of the month represented by this <tt CLASS=literal>Date</tt> 
object. The value is in the range 1 to 31. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.99">getDay</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.113">public int getDay()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1 

<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The day of the week of this <tt CLASS=literal>Date</tt>. 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns the day of the week represented by this <tt CLASS=literal>Date</tt> 
object. The value is in the range 0 to 6, where 0 means Sunday. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.100">getHours</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.114">public int getHours()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1 

<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The hour value of this <tt CLASS=literal>Date</tt>. 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns the hour represented by this <tt CLASS=literal>Date</tt> 
object. The value is in the range 0 to 23, where 0 means midnight. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.101">getMinutes</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.115">public int getMinutes()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1 

<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The minute value of this <tt CLASS=literal>Date</tt>. 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns the number of minutes after the hour represented by 
this <tt CLASS=literal>Date</tt> object. The value 
is in the range 0 to 59. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.102">getMonth</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.116">public int getMonth()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1 

<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The month of this <tt CLASS=literal>Date</tt>. 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns the month represented by this <tt CLASS=literal>Date</tt> 
object. The value is in the range 0 to 11, where 0 means January. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.103">getSeconds</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.117">public int getSeconds()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1 

<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The second value of this <tt CLASS=literal>Date</tt>. 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns the number of seconds after the minute represented 
by this <tt CLASS=literal>Date</tt> object. The value 
is in the range 0 to 59. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.104">getTime</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.118">public long getTime()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The raw time value of this <tt CLASS=literal>Date</tt>. 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns the date and time of this <tt CLASS=literal>Date</tt> 
as the number of milliseconds since midnight, January 1, 1970 GMT. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.105">getTimezoneOffset</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.119">public int getTimezoneOffset()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1 

<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The time zone offset for this <tt CLASS=literal>Date</tt>. 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns the number of minutes between the local time zone and 
GMT for this <tt CLASS=literal>Date</tt> object. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.106">getYear</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.120">public int getYear()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1 

<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The year of this <tt CLASS=literal>Date</tt>. 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns the year represented by this <tt CLASS=literal>Date</tt> 
object. The value is the number of years since 1990. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.107">hashCode</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.121">public int hashCode()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The hashcode for this <tt CLASS=literal>Date</tt>. 

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Object.hashCode()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns a hashcode for this object. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.108">setDate</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.122">public void setDate(int date)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1 

<p>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>date</tt><br>
<DD>

<P CLASS=para>
The day of the month 
specified in the range 1 to 31. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method sets the day of the month of this <tt CLASS=literal>Date</tt> 
object. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.109">setHours</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.123">public void setHours(int hours)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1 

<p>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>hours</tt><br>
<DD>

<P CLASS=para>
The hours specified 
in the range 0 to 23. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method sets the hour of this <tt CLASS=literal>Date</tt> 
object. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.110">setMinutes</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.124">public void setMinutes(int minutes)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1 

<p>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>minutes</tt><br>
<DD>

<P CLASS=para>
The minutes specified 
in the range 0 to 59. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method sets the minute value of this <tt CLASS=literal>Date</tt> 
object. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.111">setMonth</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.125">public void setMonth(int month)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1 

<p>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>month</tt><br>
<DD>

<P CLASS=para>
The month specified 
in the range 0 to 11. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method sets the month of this <tt CLASS=literal>Date</tt> 
object </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.112">setSeconds</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.126">public void setSeconds(int seconds)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1 

<p>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>seconds</tt><br>
<DD>

<P CLASS=para>
The seconds specified 
in the range 0 to 59. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method sets the second value of this <tt CLASS=literal>Date</tt> 
object. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.113">setTime</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.127">public void setTime(long time)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>time</tt><br>
<DD>

<P CLASS=para>
A time value specified 
as the number of milliseconds since midnight, January 1, 1970 GMT. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method sets the date and time represented by this <tt CLASS=literal>Date</tt> 
to the given raw time value. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.114">setYear</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.128">public void setYear(int year)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1 

<p>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>year</tt><br>
<DD>

<P CLASS=para>
The year specified 
as a value that is added to 1900 to get the actual year. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method sets the year of this <tt CLASS=literal>Date</tt> 
object. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.115">toGMTString</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.129">public String toGMTString()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1 

<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
A string that represents this <tt CLASS=literal>Date</tt>. 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
The method returns a string representation of this <tt CLASS=literal>Date</tt> 
object based on Internet GMT conventions. The string is of the form: 

<DIV CLASS=screen>
<P>
<PRE>
Sat, 8 Feb 1997 13:30:00 GMT
</PRE>
</DIV>

<P CLASS=para>
The date is the string is either one or two digits; the rest of the fields 
always have the width shown. The time zone is always GMT. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.116">toLocaleString</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.130">public String toLocaleString()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1 

<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
A string that represents this <tt CLASS=literal>Date</tt>. 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
The method returns a string representation of this <tt CLASS=literal>Date</tt> 
based on the conventions of the current locale. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.117">toString</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.131">public String toString()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
A string that represents this <tt CLASS=literal>Date</tt>. 

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Object.toString()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns a string representation of this <tt CLASS=literal>Date</tt>. 
The string is of the form: 

<DIV CLASS=screen>
<P>
<PRE>
Sat Feb 8 2:30:00 MST 1997
</PRE>
</DIV>

</DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch17-REFSECT1-AUTOID.25">Inherited Methods</A></h2>

<DIV CLASS=informaltable>
<P>
<TABLE CLASS=INFORMALTABLE>
<TR CLASS=row>
<TH ALIGN="LEFT">

<P CLASS=para>
Method</TH>
<TH ALIGN="LEFT">

<P CLASS=para>
Inherited From</TH>
<TH ALIGN="LEFT">

<P CLASS=para>
Method</TH>
<TH ALIGN="LEFT">

<P CLASS=para>
Inherited From</TH>
</TR>
<TR CLASS=row>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>clone()</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>finalize()</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
</TR>
<TR CLASS=row>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>getClass()</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>notify()</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
</TR>
<TR CLASS=row>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>notifyAll()</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>wait()</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
</TR>
<TR CLASS=row>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>wait(long)</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>wait(long, int)</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
</TR>
</TABLE>
<P>
</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch17-REFSECT1-AUTOID.26">See Also</A></h2>

<P CLASS=para>
<tt CLASS=literal>Calendar</tt>, 
<tt CLASS=literal>Cloneable</tt>, 
<tt CLASS=literal>DateFormat</tt>, 
<tt CLASS=literal>GregorianCalendar</tt>, 
<tt CLASS=literal>IllegalArgumentException</tt>, 
<tt CLASS=literal>Serializable</tt>, 
<tt CLASS=literal>TimeZone</tt> 
</DIV>


<DIV CLASS=htmlnav>

<P>
<HR align=left width=515>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch17_02.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><a href="index.htm"><img src='gifs/txthome.gif' border=0 alt='Home'></a></td>
<td width=172 align=right valign=top><A HREF="ch17_04.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
<tr>
<td width=172 align=left valign=top>Calendar</td>
<td width=171 align=center valign=top><a href="index/idx_0.htm"><img src='gifs/index.gif' alt='Book Index' border=0></a></td>
<td width=172 align=right valign=top>Dictionary</td>
</tr>
</table>
<hr align=left width=515>

<IMG SRC="gifs/smnavbar.gif" USEMAP="#map" BORDER=0> 
<MAP NAME="map"> 
<AREA SHAPE=RECT COORDS="0,0,108,15" HREF="../javanut/index.htm"
alt="Java in a Nutshell"> 
<AREA SHAPE=RECT COORDS="109,0,200,15" HREF="../langref/index.htm" 
alt="Java Language Reference"> 
<AREA SHAPE=RECT COORDS="203,0,290,15" HREF="../awt/index.htm" 
alt="Java AWT"> 
<AREA SHAPE=RECT COORDS="291,0,419,15" HREF="../fclass/index.htm" 
alt="Java Fundamental Classes"> 
<AREA SHAPE=RECT COORDS="421,0,514,15" HREF="../exp/index.htm" 
alt="Exploring Java"> 
</MAP>
</DIV>

</BODY>
</HTML>
